import CameraControl from "../Camera/CameraControl"
export default class LevelObjBase extends Laya.Script3D {
    /** 控制相机旋转的节点位置*/
    private cameraControlPos: Laya.Transform3D;

    /** 控制相机缩放  也是相机初始旋转 位置信息的节点的信息*/
    private cameraZoomPos: Laya.Transform3D;;
    /** 相机缩放最大距离*/
    public cameraMaxZoomDis: number;
    /** 当前关卡的相机*/
    private curCamera: CameraControl;

    private get CurCamera(): CameraControl {
        {
            if (this.curCamera == null) {
                this.curCamera = window.gameFacade.LevelMng.GetCurLevelCamera();
            }
            return this.curCamera;
        }
    }

    onAwake(): void {
        this.cameraControlPos = (this.owner.getChildByName("cameraControlPos") as Laya.Sprite3D).transform;
        //這個不確定
        this.cameraZoomPos = (this.owner.getChildByName("cameraControlPos").getChildByName("cameraZoomPos") as Laya.Sprite3D).transform;
    }
    onStart() {
        /** 先移出相机*/
        // this.MoveOutCamera();
    }
    /** 移出相机*/
    public MoveOutCamera() {
        this.owner.active = false;
    }
    
    /** 进入相机*/
    public MoveInCamera() {
        this.owner.active = true;
        /** 根据自身属性 传给相机相应的位置信息*/
        this.CurCamera.SetPosData(this.cameraControlPos, this.cameraZoomPos, this.cameraMaxZoomDis);
    }
}